package com.rd.student.jike.class2.lihongming.Solution713;

import java.util.Collections;
import java.util.LinkedList;

/**
 * @Auther:Heinrich
 * @Date:2023/7/14-07-14-18:32
 * @Description:com.rd.student.jike.class2.lihongming.Solution713
 * @version:1.0
 */
public class Question9 {
    public static void main(String[] args) {
        LinkedList list = new LinkedList();
        list.add("科特迪瓦");
        list.add("阿根廷");
        list.add("澳大利亚");
        list.add("塞尔维亚");
        list.add("荷兰");
        list.add("尼日利亚");
        list.add("日本");
        list.add("美国");
        list.add("中国");
        list.add("新西兰");
        list.add("巴西");
        list.add("比利时");
        list.add("韩国");
        list.add("喀麦隆");
        list.add("洪都拉斯");
        list.add("意大利");
        while (list.size()>1){
            Collections.shuffle(list);
            list = win(list);
            System.out.print("晋级者:");
            System.out.println(list);
        }



    }
    public static LinkedList win(LinkedList readyList){
        LinkedList winList = new LinkedList();
        for (int i = 0; i < readyList.size()/2; i++) {
            System.out.println(readyList.get(i)+"VS"+readyList.get(readyList.size()-i-1));
            int random = (int)Math.random()*2;
            if(random == 0){
                winList.add(readyList.get(i));
            }else{
                winList.add(readyList.get(readyList.size()-i-1));
            }
        }
        return winList;
    }
}

